﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="ChangePwd.aspx.cs" Inherits="Account_ChangePwd" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
<style type="text/css">
        .input_line
        {
            line-height: 50px;
            clear: both;
        }
        .input_label
        {
            float: left;
            width: 130px;
            text-align: right;
        }
        .input_label_font
        {
            font-size: 12pt;
            font-weight: bold;
        }
        input[type="text"], input[type="password"]
        {
            width: 200px;
            height: 23px;
            font-size: 13pt;
            font-weight: bold;
            border: 1px solid #BCE9F1;
        }
    </style>
    <div class="input_line">
        <div class="input_label">
            <label for="txtPwdOld" class="input_lable_font" >旧密码：</label>
        </div>
        <div>
            <input id="txtPwdOld" name="txtPwdOld" type="password" runat="server" />
        </div>
         <div class="input_label">
            <label for="txtPwdNew" class="input_lable_font" >新密码：</label>
        </div>
        <div>
            <input id="txtPwdNew" name="txtPwdNew" type="password" runat="server"/>
        </div>
        <div class="input_label">
            <label for="txtPwdNewConfirm" class="input_lable_font" >确认新密码：</label>
        </div>
        <div>
            <input id="txtPwdNewConfirm" name="txtPwdNewConfirm" type="password"  runat="server"/>
        </div>
        <div class="input_line">
                <div class="input_label">
                    <label class="input_label_font" for="txtVerifyCode">
                        验证码：</label>
                </div>
                <div style="float: left;">
                    <input id="txtVerifyCode" name="txtVerifyCode" maxlength="4" style="width: 60px;"
                        type="text" runat="server" />
                    <div>
                        <img alt="验证码" title="点击切换图片" id="validImg" style="float: left; background-color: White;
                            vertical-align: middle;"/><div style="float: left; margin-left: 10px; line-height: 30px;">
                                验证码不区分大小写<br />
                                <a href="javascript:return void;" onclick="reloadVerifyCode();">看不清，换一张</a>
                            </div>
                        <input type="hidden" id="vCodeTempCache" value="" />
                    </div>
                    <script type="text/javascript">
                    var verifyCodeBaseUrl = "<%= PageHelper.Url("/account/VerifyCode.aspx?") %>";
                    var imgChangeCount = 1;
                    function reloadVerifyCode() {
                        imgChangeCount++;
                        if (imgChangeCount>10) {
                            return;
                        }
                        var newImgPath = verifyCodeBaseUrl + parseInt( Math.random()*10 );
                        $("#validImg").attr( "src", newImgPath );
                    }
                    $("#validImg").click( function () {
                        reloadVerifyCode();
                    });
                    reloadVerifyCode();
                    </script>
                </div>
            </div>

        <div class="input_line" style="width:330px;text-align:center">
             <input id="btnSubmit" name="btnSubmit" type="submit" value="修改"/>
             <input id="btnReset" name="btnReset" type="reset" value="重置" />
        </div>
                   
    </div>
    <script type="text/javascript">

        function checkVerifyCode() {
            var res = CommAjaxHelper.IsCorrectVerifyCode($("#MainContent_txtVerifyCode").val());
            if (!res.value) {
                reloadVerifyCode();
            }
            return res.value;
        }
        $().ready(function () {
            // validate signup form on keyup and submit
            $("#Form1").validate({
                rules: {
                    ctl00$MainContent$txtPwdOld: {
                        required: true,
                        minlength: 6,
                        customAjaxRemote: {
                            scope: ASP.account_changepwd_aspx,
                            method: ASP.account_changepwd_aspx.CheckPwdOld
                        }
                    },
                    ctl00$MainContent$txtPwdNew: {
                        required: true,
                        minlength: 6,
                        notEqualTo: "#MainContent_txtPwdOld"
                    },
                    ctl00$MainContent$txtPwdNewConfirm: {
                        required: true,
                        minlength: 6,
                        equalTo: "#MainContent_txtPwdNew"
                    },
                    ctl00$MainContent$txtVerifyCode: {
                        required: true,
                        minlength: 4,
                        customMethod: {
                            scope: this,
                            method: checkVerifyCode
                        }
                    }
                },
                messages: {
                    ctl00$MainContent$txtPwdOld: {
                        required: "请输入旧密码",
                        minlength: "至少要输入6位的旧密码",
                        customAjaxRemote: "旧密码不正确"
                    },
                    ctl00$MainContent$txtPwdNew: {
                        required: "请输入新密码",
                        minlength: "至少要输入6位的新密码",
                        notEqualTo: "旧密码不能与新密码相同"
                    },
                    ctl00$MainContent$txtPwdNewConfirm: "两次密码不一致",
                    ctl00$MainContent$txtVerifyCode: {
                        required: "请输入验证码",
                        minlength: "长度不正确",
                        customMethod: "验证码不正确"
                    }
                }
            });
            //ASP.account_register_aspx.CheckEmail("fdaf");
            //test({ invokeObj: ASP.account_register_aspx, method: ASP.account_register_aspx.CheckEmail });

            $("#btnSubmit").click(function () { $("#Form1").submit(); });
        });
    </script>
    </asp:Content>

